@using Omu.AwesomeDemo.WebUI.Controllers
@{
    ViewBag.Title = "popup form demo";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
    <h2>
        PopupForm demo</h2>
        <script type="text/javascript">
            function success() {
                alert('country successfully created !');
            }
        </script>
    @(Html.MakePopupForm<CountryController>(o => o.Create(), "create country", 200, successFunction: "success"))
    @Html.MakePopupForm("Create", controller:"hobby", title:"create hobby", okText:"save", height:250, fullScreen:true)
    @(Html.MakePopupForm<PopupFormDemoController>(o => o.AskName(), "please tell us your name", okText: "that's my name", successFunction: "myClientFunc", height:300, position:"top"))

    @Html.PopupFormActionLink("create", "click to create a country", null, new { @class = "abtn" }, "country")
    <br />
    <br />
    @(Html.PopupFormActionLink<HobbyController>(o => o.Create(), "add a hobby", new{@class = "abtn"}))
    <br />
    <br />
    <br />

    @Html.MakePopupForm("NewOrder")
    @Html.PopupFormActionLink("NewOrder", htmlAttributes: new { @class="abtn"})

    <br />
    <br />
    <br />
    <br />
    
    @(Html.PopupFormActionLink<PopupFormDemoController>(o => o.AskName(), "popup form with custom client side success function", new { @class = "abtn" }))
    <script type="text/javascript">
        function myClientFunc(o) {
            alert('hi ' + o.Name + '\n\n you said ' + (o.SaySomething == null ? "" : o.SaySomething) + '\n\n these values came from the server as a JSON result');
        }
    </script>

